/*
https://leetcode-cn.com/problems/student-attendance-record-ii/solution/xue-sheng-chu-qin-ji-lu-ii-by-leetcode-s-kdlm/
 */

public class Solution552 {
    private static final int mod = 1000000007;
    public long[][][] f=new long[100005][2][3];
    public int checkRecord(int n) {
        f[0][0][0]=1;
        for (int i=1;i<=n;i++){
            f[i][0][0]=((f[i-1][0][0]+f[i-1][0][1])%mod+f[i-1][0][2])%mod;
            f[i][1][0]=((f[i-1][1][0]+f[i-1][1][1])%mod+f[i-1][1][2])%mod;

            f[i][1][0]=(((f[i][1][0]+f[i-1][0][0])%mod+f[i-1][0][1])%mod+f[i-1][0][2])%mod;

            f[i][0][1]=f[i-1][0][0];
            f[i][0][2]=f[i-1][0][1];
            f[i][1][1]=f[i-1][1][0];
            f[i][1][2]=f[i-1][1][1];
        }
        long ans=(((((f[n][0][0]+f[n][0][1])%mod+f[n][0][2])%mod+f[n][1][0])%mod+f[n][1][1])%mod+f[n][1][2])%mod;
        int result=(int) ans;
        return result;
    }

    public static void main(String[] args) {
        System.out.println(new Solution552().checkRecord(10101));
    }
}
